@using DNA.Mvc.Text;
@model IEnumerable<Article>
<div style="overflow: hidden;">
    @if (Model.Count() > 0)
    {
        foreach (var art in Model)
        {
            var article = new ArticleWrapper(art);
            if (!article.IsVisible(Context))
            {
                    continue;
            }
            var content = article.GetGlobalizationContent();
        <h2 class="dna-post-title">
            @Publishing.PostLink(art)
            @Publishing.PostStateImage(art, Url)
        </h2>
        <table style="width: 100%;">
            <tr>
                @if (string.IsNullOrEmpty(article.ImageUrl))
                {
                    <td style="width: 60px;">
                        <div class="d-avatar">
                            <img src="@article.Author.GetAvatar(60)" width="60" height="60" alt="avatar" /></div>
                        @Html.UserLink(art.UserName)
                    </td>
                }
                else
                {
                    <td style="width: 60px;">
                        <div class="d-avatar">
                            <img src="@Url.Content(article.ImageUrl)" width="60" height="60" alt="avatar" /></div>
                    </td>
                }
                <td style="vertical-align: top;">
                    @Publishing.PostSummary(art)
                </td>
            </tr>
        </table>
        
        <ul class="d-horizontal-list">
            @if (!string.IsNullOrEmpty(art.Tags))
            {
                <li>
                    @{ Html.RenderPartial("_Tagged", art); }
                </li>
            }
            <li>
                @{ Html.RenderPartial("_FiledUnder", article.AllCategories()); }
            </li>
        </ul>
        <hr />
        <ul class="d-horizontal-list">
            <li>@Ajax.Dna().Link("javascript:void(0);").Text(Html.Global(article.Posted)).ImageIcons(Url.Content("~/Content/Images/calendar_16.png")).GetHtml()</li>
            <li>@Ajax.Dna().Rating("ViewRatings" + article.ID.ToString()).Value(Convert.ToInt16(article.Ratings)).ReadOnly().GetHtml()</li>
            <li>Votes (@article.TotalVotes)</li>
            <li>@Ajax.Dna().Link("javascript:void(0);").LocText("publishing", "Reads").ImageIcons(Url.Content("~/Content/Images/notes.gif")).GetHtml()<span>(@article.TotalReads)</span></li>
            <li>@Ajax.Dna().Link(article.PermaLink + "#commentlist").LocText("publishing", "Comments").ImageIcons(Url.Content("~/Content/Images/comments.gif")).GetHtml()<span>(@article.TotalComments)</span></li>
        </ul>
        }
    }
    else
    { 
        <div class="ui-state-highlight ui-corner-all" style="padding: 10px; margin: 5px;
            display: block;">
            <span style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-info"></span>
            @Html.Global("Publishing", "NoArticles")</div>
    
    }
</div>
